package distributions;

import java.io.IOException;

public class HyperExponentialStream extends RandomStream
{
  private double Mean;
  private double StandardDeviation;
  private double p;

  public HyperExponentialStream(double paramDouble1, double paramDouble2)
  {
    this.Mean = paramDouble1;
    this.StandardDeviation = paramDouble2;
    double d1 = this.StandardDeviation / this.Mean;
    double d2 = d1 * d1;
    this.p = (0.5D * (1.0D - Math.sqrt((d2 - 1.0D) / (d2 + 1.0D))));
  }

  public HyperExponentialStream(double paramDouble1, double paramDouble2, int paramInt)
  {
    this.Mean = paramDouble1;
    this.StandardDeviation = paramDouble2;
    double d1 = this.StandardDeviation / this.Mean;
    double d2 = d1 * d1;
    this.p = (0.5D * (1.0D - Math.sqrt((d2 - 1.0D) / (d2 + 1.0D))));
    for (int i = 0; i < paramInt * 1000; i++)
      Uniform();
  }

  public HyperExponentialStream(double paramDouble1, double paramDouble2, int paramInt, long paramLong1, long paramLong2)
  {
    super(paramLong1, paramLong2);
    this.Mean = paramDouble1;
    this.StandardDeviation = paramDouble2;
    double d1 = this.StandardDeviation / this.Mean;
    double d2 = d1 * d1;
    this.p = (0.5D * (1.0D - Math.sqrt((d2 - 1.0D) / (d2 + 1.0D))));
    for (int i = 0; i < paramInt * 1000; i++)
      Uniform();
  }

  public double getNumber()
    throws IOException, ArithmeticException
  {
    double d = 0.0D;
    if (Uniform() > this.p)
      d = this.Mean / (1.0D - this.p);
    else
      d = this.Mean / this.p;
    return -0.5D * d * Math.log(Uniform());
  }
}

/* Location:           /tmp/dlpjava/dlpjava.jar
 * Qualified Name:     distributions.HyperExponentialStream
 * JD-Core Version:    0.6.0
 */